<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>更新日志</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.mongogridfsexception.html">MongoGridFSException</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.msql.html">mSQL</a></div>
 <div class="up"><a href="book.mongo.html">Mongo</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="changelog.mongo" class="appendix">
 <h1>更新日志</h1>

 <p class="para">对本扩展的类／函数／方法有以下更新。</p>

 
 <div class="simplesect">
  <h3 class="title">MongoDB PHP Driver 1.3.0</h3>
  <p class="para">
   The 1.3 series introduced several major changes to the extension such as
   completely rewritten <a href="mongo.connecting.html" class="link">connection
   handling</a> (and removal of the pooling mechanism), support for
   <a href="mongo.readpreferences.html" class="link">ReadPreferences</a> and change the
   default <a href="mongo.writes.html" class="link">WriteConcerns</a> to be
   <em class="emphasis">acknowledged</em> by introducing a new class
   <a href="class.mongoclient.html" class="link">MongoClient</a> which serves as a
   replacement class for the now deprecated <a href="class.mongo.html" class="classname">Mongo</a> class.
  </p>
  <p class="para">
   The driver now also supports connecting to multiple mongos instances (the
   Mongo Shard router) for loadbalancing.
  </p>
  <p class="para">
   Other enhancements include improved logging for easier connection handling
   debugging with <a href="class.mongolog.html" class="classname">MongoLog</a> and support for the
   <a href="http://docs.mongodb.org/manual/core/aggregation-pipeline/" class="link external">&raquo;&nbsp;Aggregation Framework</a>
   via the <span class="methodname"><a href="mongocollection.aggregate.html" class="methodname">MongoCollection::aggregate()</a></span> method.
  </p>
 </div>


 <div class="simplesect">
  <h3 class="title">Changes to existing methods</h3>
  <p class="para">
  Following is a list of all improvements to existing methods since
  their inception.
  </p>
  <table class='doctable table' rules='groups'><thead><tr><th>Version</th><th>Function</th><th>Description</th></tr></thead><tbody class="gen-changelog v"><tr><td>1.4.5</td><td><a href='mongocursor.batchsize.html'>MongoCursor::batchSize</a></td><td>Before 1.4.5, this method would throw an
         MongoCursorException if the cursor had already
         started iterating.</td></tr></tbody><tbody class="gen-changelog v1-4-5"><tr><td>1.4.0</td><td><a href='mongocursor.hint.html'>MongoCursor::hint</a></td><td>The index argument now supports index names as
         string values. In versions before 1.4.0, only array or object values
         were accepted.</td></tr><tr><td>&nbsp;</td><td><a href='mongocursor.setflag.html'>MongoCursor::setFlag</a></td><td>Support for flag 3 (OPLOG_REPLAY) is added. Versions before 1.4.0
        would throw a warning saying that the flag is unsupported.</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.createcollection.html'>MongoDB::createCollection</a></td><td>In versions before 1.4.0, the options were all arguments to the method. The
         function synopsis in those older versions is:
        
        
         
          public MongoCollectionMongoDB::createCollection
          stringname
          boolcappedFALSE
          intsize0
          intmax0
         
        
        
         The meaning of the options is the same as described under the
         options argument above.</td></tr></tbody><tbody class="gen-changelog v1-4-0"><tr><td>1.3.4</td><td><a href='mongoclient.construct.html'>MongoClient::__construct</a></td><td>添加了 &quot;connectTimeoutMS&quot; 和
         &quot;socketTimeoutMS&quot; 选项。</td></tr></tbody><tbody class="gen-changelog v1-3-4"><tr><td>1.3.3</td><td><a href='mongoclient.getreadpreference.html'>MongoClient::getReadPreference</a></td><td>返回的值修改为兼容
        MongoClient::setReadPreference。
        type 的值从数组改成字符串，删除了
        type_string，并且
        tagsets 现在以键值表示的标签而不是冒号分隔的字符串。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.getreadpreference.html'>MongoCollection::getReadPreference</a></td><td>The return value has changed to be consistent with
        MongoCollection::setReadPreference. The
        type value was changed from a number to a string,
        type_string was removed, and
        tagsets now expresses tags as key/value pairs instead
        of colon-delimited strings.</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.getreadpreference.html'>MongoDB::getReadPreference</a></td><td>The return value has changed to be consistent with
        MongoDB::setReadPreference. The
        type value was changed from a number to a string,
        type_string was removed, and
        tagsets now expresses tags as key/value pairs instead
        of colon-delimited strings.</td></tr></tbody><tbody class="gen-changelog v1-3-3"><tr><td>1.3.0</td><td><a href='mongoclient.close.html'>MongoClient::close</a></td><td>在 1.3.0 版本中，为这个函数添加了 connection 参数。
         在此之前，直邮写入连接才会被这个方法关闭。</td></tr><tr><td>&nbsp;</td><td><a href='mongoclient.construct.html'>MongoClient::__construct</a></td><td>添加了 &quot;readPreference&quot;、
         &quot;readPreferenceTags&quot;、&quot;w&quot; 和
         &quot;wTimeout&quot; 选项。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.ensureindex.html'>MongoCollection::ensureIndex</a></td><td>The options parameter no longer accepts a boolean
        to signify a unique index. Instead, this now has to be done with
        array('unique' =&gt; true).</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.insert.html'>MongoCollection::insert</a></td><td>options 参数不再接受 boolean 来标识一个确认的写入。
        现在，你可以通过
        array('w' =&gt; 1) 设置（
        MongoClient 默认的行为）</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.remove.html'>MongoCollection::remove</a></td><td>options 参数不再接受 boolean 值来代表 &quot;justOne&quot;。
        现在，必须使用 array('justOne' =&gt; true) 作为替代。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.update.html'>MongoCollection::update</a></td><td>The options parameter no longer accepts a boolean
        to signify an upsert. Instead, this now has to be done with
        array('upsert' =&gt; true).</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.listcollections.html'>MongoDB::listCollections</a></td><td>Added the includeSystemCollections parameter.</td></tr><tr><td>&nbsp;</td><td><a href='mongogridfscursor.key.html'>MongoGridFSCursor::key</a></td><td>The document's _id is returned as a string value,
        since the key should be unique. Pre-1.3.0, filename
        was returned.</td></tr></tbody><tbody class="gen-changelog v1-3-0"><tr><td>1.2.11</td><td><a href='mongo.getpoolsize.html'>Mongo::getPoolSize</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongo.getslave.html'>Mongo::getSlave</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongo.getslaveokay.html'>Mongo::getSlaveOkay</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongo.pooldebug.html'>Mongo::poolDebug</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongo.setslaveokay.html'>Mongo::setSlaveOkay</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongo.switchslave.html'>Mongo::switchSlave</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongobindata.construct.html'>MongoBinData::__construct</a></td><td>没有使用第二个参数时产生  E_DEPRECATED。
        type 的默认值在近期的功能里可能会改变。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.ensureindex.html'>MongoCollection::ensureIndex</a></td><td>Emits E_DEPRECATED when
        options is scalar.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.getslaveokay.html'>MongoCollection::getSlaveOkay</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.group.html'>MongoCollection::group</a></td><td>Emits E_DEPRECATED when
        options is scalar.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.remove.html'>MongoCollection::remove</a></td><td>当 options 是 scalar 时产生一个 E_DEPRECATED 警告。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.setslaveokay.html'>MongoCollection::setSlaveOkay</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.update.html'>MongoCollection::update</a></td><td>Emits E_DEPRECATED when
        options is scalar.</td></tr><tr><td>&nbsp;</td><td><a href='mongocursor.doquery.html'>MongoCursor::doQuery</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.authenticate.html'>MongoDB::authenticate</a></td><td>使用时产生 E_DEPRECATED。
        请将验证细节传入到构造器。</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.forceerror.html'>MongoDB::forceError</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.getslaveokay.html'>MongoDB::getSlaveOkay</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.preverror.html'>MongoDB::prevError</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.reseterror.html'>MongoDB::resetError</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.setslaveokay.html'>MongoDB::setSlaveOkay</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongopool.getsize.html'>MongoPool::getSize</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongopool.info.html'>MongoPool::info</a></td><td>Emits E_DEPRECATED when used.</td></tr><tr><td>&nbsp;</td><td><a href='mongopool.setsize.html'>MongoPool::setSize</a></td><td>Emits E_DEPRECATED when used.</td></tr></tbody><tbody class="gen-changelog v1-2-11"><tr><td>1.2.10</td><td><a href='mongoclient.gethosts.html'>MongoClient::getHosts</a></td><td>对非集群的支持。
        
        
         返回的数组元素现在也包括了
         hostname 和 port。</td></tr></tbody><tbody class="gen-changelog v1-2-10"><tr><td>1.2.7</td><td><a href='mongocollection.batchinsert.html'>MongoCollection::batchInsert</a></td><td>Added &quot;continueOnError&quot; option.</td></tr></tbody><tbody class="gen-changelog v1-2-7"><tr><td>1.2.5</td><td><a href='mongogridfs.storeupload.html'>MongoGridFS::storeUpload</a></td><td>Changed second parameter to an array of metadata. Pre-1.2.5, the
        second parameter was an optional string overriding the filename.</td></tr></tbody><tbody class="gen-changelog v1-2-5"><tr><td>1.2.0</td><td><a href='mongoclient.close.html'>MongoClient::close</a></td><td>在版本 1.2.0 之前，这个驱动默认不会使用持久连接，所有连接会在作用域结束时关闭。
         由于版本 1.2.0 情况不再如此，所以调用 close 会是一个坏主意，在服务器有较高负载时可能会造成更高的压力。</td></tr><tr><td>&nbsp;</td><td><a href='mongoclient.construct.html'>MongoClient::__construct</a></td><td>添加了 &quot;username&quot; 和
         &quot;password&quot; 选项。
        
        
         移除了 &quot;persist&quot; 选项，所有的连接都是持久的。它仍旧能够使用，但是不起作用。
        
        
         
          
           &quot;persist&quot;
          
          
           
            是否应该是持久连接。如果设置了，连接会是持久连接。
            字符形式的值将会用于连接的 ID。所以两个以 array(&quot;persist&quot; =&gt; &quot;foobar&quot;) 初始化的 MongoClient 实例会共享一个数据库连接，以 array(&quot;persist&quot; =&gt; &quot;barbaz&quot;)初始化的实例则使用不同的数据库连接。
           
          
         
        
        
         &quot;replicaSet&quot; 选项现在支持一个字符串，而不是布尔值。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.ensureindex.html'>MongoCollection::ensureIndex</a></td><td>Added &quot;timeout&quot; option.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.insert.html'>MongoCollection::insert</a></td><td>增加了 &quot;timeout&quot; 选项。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.remove.html'>MongoCollection::remove</a></td><td>添加 &quot;timeout&quot; 选项。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.save.html'>MongoCollection::save</a></td><td>增加 &quot;timeout&quot; 选项。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.update.html'>MongoCollection::update</a></td><td>Added &quot;timeout&quot; option.</td></tr><tr><td>&nbsp;</td><td><a href='mongodb.command.html'>MongoDB::command</a></td><td>Added options parameter with a single option: 
        &quot;timeout&quot;.</td></tr></tbody><tbody class="gen-changelog v1-2-0"><tr><td>1.1.0</td><td><a href='mongocursor.info.html'>MongoCursor::info</a></td><td>Added a number of other fields, including id (the 
        cursor id), at (the driver's counter of which 
        document is current), numReturned (the number 
        returned by the server in the current batch), and 
        server (which server the query was sent 
        to&mdash;useful in conjunction with
        .</td></tr></tbody><tbody class="gen-changelog v1-1-0"><tr><td>1.0.11</td><td><a href='mongocollection.ensureindex.html'>MongoCollection::ensureIndex</a></td><td>The &quot;safe&quot; option will trigger a primary failover,
         if necessary.
        
        
         MongoException will be thrown if the index name
         (either generated or set) is longer than 128 bytes.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.insert.html'>MongoCollection::insert</a></td><td>如果设置了 &quot;safe&quot;，出现 &quot;not master&quot; 错误时断开连接。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.remove.html'>MongoCollection::remove</a></td><td>在设置了 &quot;safe&quot; 之后，将在出现 &quot;not master&quot; 错误时断开连接。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.save.html'>MongoCollection::save</a></td><td>设置 &quot;safe&quot; 时，当出现 &quot;not master&quot; 错误时主动断开连接。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.update.html'>MongoCollection::update</a></td><td>Disconnects on &quot;not master&quot; errors if &quot;safe&quot; is set.</td></tr></tbody><tbody class="gen-changelog v1-0-11"><tr><td>1.0.10</td><td><a href='mongocursor.info.html'>MongoCursor::info</a></td><td>Added started_iterating field, a boolean indicating
        if cursor is pre- or post-query.</td></tr></tbody><tbody class="gen-changelog v1-0-10"><tr><td>1.0.9</td><td><a href='mongoclient.construct.html'>MongoClient::__construct</a></td><td>添加了 &quot;replicaSet&quot; 选项。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.batchinsert.html'>MongoCollection::batchInsert</a></td><td>Added ability to pass integers to the &quot;safe&quot; option,
         which previously only accepted booleans.
        
        
         Added &quot;fsync&quot; option.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.insert.html'>MongoCollection::insert</a></td><td>&quot;safe&quot; 选项接受 integer 值，之前只接受 boolean 值。
        
        
         增加 &quot;fsync&quot; 选项。
        
        
         如果设置了 &quot;safe&quot; 选项，返回类型改成包含错误信息的 array。
         否则，和之前一样返回 boolean。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.remove.html'>MongoCollection::remove</a></td><td>添加了 &quot;safe&quot; 选项对 integer 的支持，之前只接受 boolean 值。
        
        
         添加了 &quot;fsync&quot; 选项。
        
        
         当使用了 &quot;safe&quot; 选项时将会返回包含错误信息的数组。
         否则和之前一样返回一个 boolean。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.save.html'>MongoCollection::save</a></td><td>选项 &quot;safe&quot; 接受 integer 的值，之前仅仅接受 boolean。
        
        
         增加 &quot;fsync&quot; 选项。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.update.html'>MongoCollection::update</a></td><td>Added ability to pass integers to the &quot;safe&quot; option,
         which previously only accepted booleans.
        
        
         Added &quot;fsync&quot; option.
        
        
         The return type was changed to be an array containing error information
         if the &quot;safe&quot; option is used. Otherwise, a boolean
         is returned as before.</td></tr></tbody><tbody class="gen-changelog v1-0-9"><tr><td>1.0.7</td><td><a href='mongocollection.count.html'>MongoCollection::count</a></td><td>添加了 limit 和 skip
        参数。</td></tr></tbody><tbody class="gen-changelog v1-0-7"><tr><td>1.0.5</td><td><a href='mongocollection.batchinsert.html'>MongoCollection::batchInsert</a></td><td>Added options parameter.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.ensureindex.html'>MongoCollection::ensureIndex</a></td><td>Added the &quot;name&quot; option to override index name
        creation.</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.insert.html'>MongoCollection::insert</a></td><td>修改第二个参数为选项数组。在 1.0.5 之前，第二个参数是 boolean，指示 &quot;safe&quot; 选项。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.remove.html'>MongoCollection::remove</a></td><td>修改第二个参数为选项的 array。在 1.0.5 之前，第二个选项是 boolean 值，
        代表了 &quot;safe&quot; 选项。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.save.html'>MongoCollection::save</a></td><td>增加 options 参数。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.update.html'>MongoCollection::update</a></td><td>Added &quot;safe&quot; option.</td></tr></tbody><tbody class="gen-changelog v1-0-5"><tr><td>1.0.2</td><td><a href='mongoclient.construct.html'>MongoClient::__construct</a></td><td>修改构造器支持选修数组。在 1.0.2 之前，构造器接受以下参数：
        
        
         
          
           server
          
          
           
            服务器名。
           
          
         
         
          
           connect
          
          
           
            可选的 boolean 参数指定了构造器是否应该在返回前连接到数据库。默认为 TRUE。
           
          
         
         
          
           persistent
          
          
           
            连接是否应该是持久的。
           
          
         
         
          
           paired
          
          
           
            连接是否应该为 paired 模式。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.ensureindex.html'>MongoCollection::ensureIndex</a></td><td>Changed options parameter from boolean to array.
        Pre-1.0.2, the second parameter was an optional boolean value specifying
        a unique index.</td></tr></tbody><tbody class="gen-changelog v1-0-2"><tr><td>1.0.1</td><td><a href='mongocollection.insert.html'>MongoCollection::insert</a></td><td>如果设置了 &quot;safe&quot; 选项并且插入失败了，将会抛出 MongoCursorException。</td></tr><tr><td>&nbsp;</td><td><a href='mongocollection.update.html'>MongoCollection::update</a></td><td>Changed options parameter from boolean to array.
        Pre-1.0.1, the second parameter was an optional boolean value specifying
        an upsert.</td></tr></tbody></table>
 </div>


</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.mongogridfsexception.html">MongoGridFSException</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.msql.html">mSQL</a></div>
 <div class="up"><a href="book.mongo.html">Mongo</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
